﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MethodWorx.CMS.Plugins;
using MethodWorx.CMS.TemplateLanguage;
using MethodWorx.CMS.Providers;

namespace MethodWorx.CMS.Administration
{
    public class WebFormsApplicationType : ApplicationType, IPlugin
    {
        private static IdeExtension urlRoutingIdeExtension;

        private ICmsDataProvider provider;
        public void SetProvider(ICmsDataProvider provider)
        {
            this.provider = provider;
        }

        public Guid Id { get { return new Guid("{83AE52D4-595F-4750-B076-6D004CFDEB92}"); } }

        static WebFormsApplicationType()
        {
            urlRoutingIdeExtension = new IdeExtension
            {
                Id = Guid.Parse("{A799EDA9-6686-4F4F-AE31-840EC8E479D5}"),
                DisplayName = "URL Routing",
                Name = "UrlRouting",
                WebEditor = new AssemblyResourceReference(typeof(WebFormsApplicationType).Assembly, "Plugins/Views/PageTemplate/WebFormsApplicationTypeUrlRouting.ascx"),
                Controller = typeof(WebFormsApplicationTypeUrlRoutingIdeExtension)
            };
        }

        public override Guid ApplicationTypeId
        {
            get { return new Guid("{83AE52D4-595F-4750-B076-6D004CFDEB92}"); }
        }

        public override string Name
        {
            get { return "ASP.NET WebForms"; }
        }

        public override string Description
        {
            get { return "Configures the CMS to be hosted within a custom ASP.NET Webforms application"; }
        }

        public override ApplicationTypeConfiguration Configuration
        {
            get { return null; }
        }
    
        #region IPlugin Members

        public IEnumerable<IdeExtension>  GetIdeExtensionsForPageTemplate(Content.PageTemplate template)
        {
            yield return urlRoutingIdeExtension;
        }

        public IEnumerable<IdeExtension>  GetIdeExtensions()
        {
            yield return urlRoutingIdeExtension;
        }

        #endregion

        #region IPlugin Members


        public IEnumerable<IParser> GetTmlExtensions()
        {
            return null;
        }

        #endregion


        public IEnumerable<IdeExtension> GetIdeExtensionsForPage(Content.Page page)
        {
            return new IdeExtension[] { };
        }
    }
}
